{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# test some on code"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "import os\n",
    "from os import path\n",
    "import matplotlib as mplt\n",
    "import tensorflow as tf\n",
    "\n",
    "mnist_path = \"../MNIST_data\"\n",
    "train_data_path = path.join(mnist_path, \"train-images-idx3-ubyte\")\n",
    "train_label_path = path.join(mnist_path, \"train-labels-idx1-ubyte\")\n",
    "\n",
    "fd = open(train_data_path, \"rb\")\n",
    "fd_label = open(train_label_path, \"rb\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "loaded = np.fromfile(file=fd, dtype=np.uint8)\n",
    "loaded_label = np.fromfile(file=fd_label, dtype=np.uint8)\n",
    "trX = loaded[16:].reshape((60000, 28, 28, 1)).astype(np.float)\n",
    "trY = loaded_label[8:].reshape((60000)).astype(np.int32)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "cm = mplt.cm.gray\n",
    "\n",
    "plt.ion()\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.image.AxesImage at 0x1368b85f8>"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAWEAAAFfCAYAAACfj30KAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAAPYQAAD2EBqD+naQAAIABJREFUeJztnW2sdGtZ3//Xntmz35+QQnOOkaaiR9OSRmOxUKLUY48J\nygekXzDWBKkfDEEaQ9JKSEgPwgejBkOjOY1pWtC0mpCoRQ2cgyK+EEQsBsNLkEgPAsJ5BI6B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3nMGzEudzrGuIE/1PVxL+L9YTxN\n4eMY/xOfAvh/AP4bgH/c9XFXvK/oPV0CeIV73Fp+d03vbxW/O05lSQghHbJSOWFCCNk0KGFCCOkQ\nSpgQQjqEEiaEkA6hhAkhpEMoYUII6RBKmBBCOoQSJoSQDqGECSGkQyhhQgjpEEqYEEI6hBImhJAO\n+f9QwPtf93fUVgAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x112c186a0>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.imshow(np.reshape(trX[2,:,:], (28, 28)), cm)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "data_queues = tf.train.slice_input_producer([trX, trY])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "X, Y = tf.train.shuffle_batch(data_queues, num_threads=4,\n",
    "                                  batch_size=64,\n",
    "                                  capacity= 64 * 64,\n",
    "                                  min_after_dequeue=64 * 32,\n",
    "                                  allow_smaller_final_batch=False)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[<tf.Tensor 'input_producer/Gather:0' shape=(28, 28, 1) dtype=float64>,\n",
       " <tf.Tensor 'input_producer/Gather_1:0' shape=() dtype=int32>]"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "one_hot = tf.one_hot(Y, depth=10, axis=1, dtype=tf.float32)\n",
    "data_queues"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "tensorflow.python.framework.ops.Tensor"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": []
  }
 ],
 "metadata": {
  "anaconda-cloud": {},
  "kernelspec": {
   "display_name": "Python [conda root]",
   "language": "python",
   "name": "conda-root-py"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.5.2"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 1
}
